package com.hejjon.enumer;

/**
 *
 * 数据库驱动枚举
 * @author: cs
 * @date: 2025-02-21 17:33:09
 * @since: 1.0
 */
public enum DriverEnum {

    MYSQL("MySql", "com.mysql.cj.jdbc.Driver"),

    ORACLE("Oracle", "oracle.jdbc.driver.OracleDriver"),

    SQL_SERVER("SQLServer", "com.microsoft.sqlserver");

    private String type;

    private String driver;

    DriverEnum(String type, String driver) {
        this.type = type;
        this.driver = driver;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }


    public static DriverEnum getInstance(String driveType) {
        for (DriverEnum value : DriverEnum.values()) {
            if (driveType.equalsIgnoreCase(value.type)) {
                return value;
            }
        }
        return null;
    }

}
